using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace SqlTools.CodeGenerator.Data
{
	public class IntrinsicTableProperty : TableProperty
	{
		protected bool _baseClassPK;

		public IntrinsicTableProperty(string name, Table table, string columnName)
			: base(name, table, columnName)
		{
			_baseClassPK = false;
		}

		public override TablePropertyType Type
		{
			get { return TablePropertyType.Intrinsic; }
		}

		public bool BaseClassPK
		{
			get { return _baseClassPK; }
			set { _baseClassPK = value; }
		}

		public override XmlElement CreateXmlElement(XmlDocument doc)
		{
			XmlElement prop = base.CreateXmlElement(doc);

			prop.Attributes.Append(doc.CreateAttribute("BaseClassPK")).Value = _baseClassPK.ToString();

			return prop;
		}

		public override void LoadXml(XmlElement xmlProp)
		{
			base.LoadXml(xmlProp);

			string temp = xmlProp.GetAttribute("BaseClassPK");

			bool.TryParse(temp, out _baseClassPK);
		}
	}
}
